//
//  ResonView.m
//  FKGW
//
//  Created by song ce on 2017/3/21.
//  Copyright © 2017年 song ce. All rights reserved.
//

#import "ResonView.h"

@implementation ResonView


- (IBAction)type:(UIButton *)sender {
    self.selectedTypeBtn = sender;
    sender.backgroundColor = DEF_COLOR;
    [sender setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    UIButton *btn;
    for(int i=0;i<self.typeBtns.count;i++){
        btn =self.typeBtns[i];
        if(![btn isEqual:sender]){
            btn.backgroundColor = DEF_COLOR;
            [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        }
}
}


- (IBAction)reson:(UIButton *)sender {
     self.selectedReasonBtn = sender;
     sender.backgroundColor = DEF_COLOR;
     [sender setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    UIButton *btn;
    for(int i=0;i<self.reasonBtns.count;i++){
        btn =self.reasonBtns[i];
        if(![btn isEqual:sender]){
            btn.backgroundColor = DEF_COLOR;
            [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        }
  }
}

- (IBAction)colse:(UIButton *)sender {
    if(self.closeBlock){
        self.closeBlock();
    }
}


//提交退款申请
- (IBAction)commit:(UIButton *)sender {
    if(self.selectedTypeBtn==nil){
        [MBProgressHUD showWarnMessage:@"请选择退款类型"];
        return;
    }
    if(self.selectedReasonBtn==nil){
        [MBProgressHUD showWarnMessage:@"请选择退款原因"];
        return;
    }
    NSString *type = self.selectedTypeBtn.currentTitle;
    NSString *reason = self.selectedReasonBtn.currentTitle;
    
    if(self.commitBlock){
        self.commitBlock(type,reason);
    }
}

@end
